package com.xyd.service;

import com.xyd.dao.UserDao;
import com.xyd.entity.User;
import com.xyd.util.SqlSessionFactoryUtil;
import org.apache.ibatis.session.SqlSession;

public class UserServiceImpl {

    SqlSession sqlSession = SqlSessionFactoryUtil.getSqlSession();
    UserDao userDao = sqlSession.getMapper(UserDao.class);

    public void userReg(User user) {
        try {
            userDao.userReg(user);
            sqlSession.commit();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            sqlSession.close();
        }
    }

    public User userLogin(User user) {
        return userDao.userLogin(user);
    }
}
